import axios from '@/libs/api.request'

export const getLockDevice = ({ pageNum, pageSize }) => {
  return axios.request({
    url: 'get_lock_device',
    params: {
      pageNum,
      pageSize
    },
    method: 'get'
  })
}

export const setMeetDeviceState = ({ id, setAction }) => {
  return axios.request({
    url: 'set_lock_device_state',
    params: {
      id,
      setAction
    },
    method: 'get'
  })
}
export const delMeetDevice = (id) => {
  return axios.request({
    url: 'del_lock_device',
    params: {
      id
    },
    method: 'get'
  })
}

export const editMeetDevice = ({ id, team_id, name, state }) => {
  const data = {
    id,
    team_id,
    name,
    state
  }
  return axios.request({
    url: 'edit_lock_device',
    data,
    method: 'post'
  })
}

export const addDevice = ({ name, team_id, state }) => {
  if (getIsTeam()) {
    team_id = null
  }
  const data = {
    name,
    team_id,
    state
  }
  return axios.request({
    url: 'add_lock_device',
    data,
    method: 'post'
  })
}
